package com.h1909d.weinfo.ui.adapter;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.h1909d.weinfo.base.BaseLazyFragment;

import java.util.ArrayList;

public class VpZhihuAdapter extends FragmentPagerAdapter {

    private ArrayList<String> list;
    private ArrayList<BaseLazyFragment> baseLazyFragments;

    public VpZhihuAdapter(FragmentManager fm, ArrayList<String> list, ArrayList<BaseLazyFragment> baseLazyFragments) {
        super(fm);
        this.list = list;
        this.baseLazyFragments = baseLazyFragments;
    }



    @Override
    public Fragment getItem(int position) {
        return baseLazyFragments.get(position);
    }

    @Override
    public int getCount() {
        if (baseLazyFragments != null){

        return baseLazyFragments.size();
        }
        return 1;
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return list.get(position);
    }
}
